// Rate

@import '../../style/themes/default';
@import '../../style/mixins/index';
@import './param';

@mixin rate {
  width: 100%;
  @include flex();
  > label {
    display: inline-block;
    white-space: nowrap;
    height: $--x-rate-height;
    line-height: $--x-rate-height;
    position: relative;
    color: $--x-text-300;
    font-weight: 600;
    @include text-align();
  }
  &-icons {
    display: inline-flex;
    align-items: center;
    height: $--x-rate-height;
    cursor: pointer;
  }
  &-icon {
    margin: 0 0.2rem;
    display: flex;
    align-items: center;
    position: relative;
    color: $--x-info;
    transition: transform $--x-animation-duration-base, color $--x-animation-duration-base;
    font-size: $--x-rate-icon-font-size;
    .x-icon {
      vertical-align: 0;
    }
    &:hover {
      transform: scale(1.1);
    }
    &.activated {
      color: $--x-warning;
    }
    &.half-activated {
      .x-rate-half {
        color: $--x-warning;
      }
    }
  }
  &-half {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    &:hover {
      opacity: 1;
    }
  }
  &-back {
    display: flex;
    align-items: center;
  }
  &.x-invalid,
  &.x-required {
    > label {
      color: $--x-danger;
    }
  }
  &.x-disabled {
    .#{$--x-rate-prefix} {
      &-icons {
        cursor: not-allowed;
      }
      &-icon {
        color: $--x-info-500;
        &:hover {
          transform: scale(1);
        }
        &.activated {
          color: $--x-warning-500;
        }
        &.half-activated {
          .x-rate-half {
            color: $--x-warning-500;
          }
        }
      }
    }
  }
  &.x-direction {
    &-row {
      > label {
        padding: 0 0.5rem 0 0;
      }
    }
    &-row-reverse {
      > label {
        padding: 0 0 0 0.5rem;
      }
    }
    &-column {
      align-items: inherit;
    }
    &-column-reverse {
      align-items: inherit;
    }
  }
}
